package net.asfun.jvalog.http;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.asfun.jvalog.misc.ThreadHelper;
import net.asfun.jvalog.task.DataTask;

public class TaskServlet extends HttpServlet{

	private static final long serialVersionUID = 20090726163924L;

	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		String action = RequestUtil.getRequiredParam(req, "do");
		ThreadHelper.startup();
		if ( action.equals("update") ) {
			DataTask.update();
		}
		ThreadHelper.shutdown();
	}
	
	public void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		resp.sendError(403);
	}
}
